package com.example.demo.web.manage.controller;

import com.example.demo.web.manage.dto.UserDto;
import com.example.demo.web.manage.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.*;

@Controller
@Mapping("/user")
@Api("用户管理")
public class UserController {
  @Inject private UserService service;

  @Mapping("addAll")
  @Post
  @ApiOperation("新增全部")
  public Boolean addAll(@Body UserDto userDto) {
    service.addAll(userDto);

    return true;
  }

  @Mapping("rollbackAll")
  @Post
  @ApiOperation("回滚全部")
  public Boolean rollbackAll(@Body UserDto userDto) {
    service.rollbackAll(userDto);

    return true;
  }

  @Mapping("rollbackAll1")
  @Post
  @ApiOperation("回滚全部1")
  public Boolean rollbackAll1(@Body UserDto userDto) {
    return service.rollbackAll1(userDto);
  }

  @Mapping("rollbackSub")
  @Post
  @ApiOperation("回滚子表")
  public Boolean rollbackSub(@Body UserDto userDto) {
    service.rollbackSub(userDto);

    return true;
  }

  @Mapping("rollbackMaster")
  @Post
  @ApiOperation("回滚主表")
  public Boolean rollbackMaster(@Body UserDto userDto) {
    service.rollbackMaster(userDto);
    return true;
  }
}
